package org.example.view;

import org.example.view.componet.BackgroundScene;

import javax.swing.*;
import java.awt.*;

public class MainFrame extends JFrame {
    private Container contentP;
    private MainPanel mainPanel;

    public MainFrame() {
        this.setSize(1024, 768);
        this.setLocationRelativeTo(null);
        this.setTitle("欢迎使用中国银行ATM");
        this.setIconImage(Toolkit.getDefaultToolkit().createImage("/Users/cengyunke/Desktop/atm1/ATMGUI/src/main/java/org/example/img/logo.jpg"));
        this.setResizable(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.addContent();
        this.setVisible(true);
    }

    private void addContent() {
        this.contentP = this.getContentPane();//获取窗体的内容面板
        this.contentP.setLayout(null);//设置空布局，即采用绝对定位的方式
        this.contentP.setBackground(Color.WHITE);//设置内容面板背景色
        this.mainPanel = new MainPanel();
        this.mainPanel.setBounds(0, 0, 1024, 768);
        this.contentP.add(this.mainPanel);
    }
}
